[1.0] Data Structures in Java (Introduction)
Data: Integers, Float, Strings, Characters etc.
- Data can be stored in two ways in computers:
1) RAM: Random Access Memory -> CPU directly accesses RAM as it is faster to access
2) Hard Drive/ SSD: -> Data is stored permanently inside the hard drive.
Program: Set of instructions that CPU accesses in Main Memory.
RAM is a continous block of storage and each block is assigned a memory address.
Why we need Data Structures?
Since CPU is a very important resource and it consumes some time to access main memory, we need to store the data efficiently.
Example: Dictionary used alphabetical order to store words which makes it easier for us to search for the word and its meaning among millions of words.
Different structures provide different advantages in various applications.
We will study them in the upcoming modules.
How to structure data in memory?
Since data is stored in RAM and CPU needs to access it we can use memory referencing to connect the data and obtain any structure we desire.